package com.hulk.ratel.common.security;

import javax.crypto.KeyGenerator;
import javax.crypto.SecretKey;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;




public class AesSeedKey {

    private static final String SEED = "SEED";
    //private static final String AES_ALGORITHM = "AES/ECB/PKCS5Padding";
    private static final String ALGORITHM = "AES";


    private static SecretKey geneAesKey() {
        KeyGenerator keyGenerator = null;
        SecureRandom random = null;
        try {
            keyGenerator = KeyGenerator.getInstance(ALGORITHM);
            random = SecureRandom.getInstance("SHA1PRNG");
        } catch (NoSuchAlgorithmException e) {
            e.printStackTrace();
            throw new RuntimeException(e);
        }


        random.setSeed(SEED.getBytes());
        keyGenerator.init(128, random);
        SecretKey secretKey = keyGenerator.generateKey();
        return secretKey;
    }


}
